import React, {useState} from 'react';
import {Drawer, Menu} from 'antd';
import {
    MenuOutlined
} from '@ant-design/icons'
import {Link,useLocation} from 'react-router-dom'
import logo from '../../assets/logo.png'
import './style.less';


const Header = () => {
    const [visible, setVisible] = useState(false);
    const location = useLocation()
    const showDrawer = () => {
        setVisible(!visible);
    };
    const onClose = () => {
        setVisible(false);
    };
    return (
        <header className={'header-wrapper'}>
            <div className='header-icon'>
                <img src={logo} alt='logo'/>
            </div>
            <div className='header-title'>
                浙江东都建筑设计研究院有限公司
            </div>
            <div className='header-router'>
                <MenuOutlined onClick={showDrawer} className='header-menu-icon'/>
                <Drawer onClose={onClose} visible={visible} closable={false}>
                    <Menu
                        style={{height: '100%', paddingTop: '1vh'}}
                        selectedKeys={[location.pathname]}
                        mode="inline"
                        theme="dark"
                    >
                        <Menu.Item key="/">
                            <Link to="/">主页</Link>
                        </Menu.Item>
                        <Menu.Item key='/news'>
                            <Link to="/news">新闻中心</Link>
                        </Menu.Item>
                        <Menu.Item key="/introduce">
                            <Link to="/introduce">主要介绍</Link>
                        </Menu.Item>
                        <Menu.Item key='/enginerIntroduce'>
                            <Link to="/enginerIntroduce">专家介绍</Link>
                        </Menu.Item>
                        <Menu.Item key="/messageBoard">
                            <Link to="/messageBoard">联系我们</Link>
                        </Menu.Item>
                    </Menu>
                </Drawer>
            </div>
        </header>
    );
}

export default Header;
